﻿// Write a program that converts a number in the range [0...999] to a text corresponding to its English pronunciation. Examples:
// 0 -> "Zero"
// 273 -> "Two hundred seventy three"
// 400 -> "Four hundred"
// 501 -> "Five hundred and one"
// 711 -> "Seven hundred and eleven"

using System;

class PrintingNumbersNames
{
    static void Main()
    {
        Begin:
        Console.Write("Enter integer number betwen 0 and 999: ");
        short userInput = short.Parse(Console.ReadLine());
                                                                // 567  56 
        //Console.WriteLine( userInput / 10 );                  // 56   5  
        //Console.WriteLine( userInput / 100 );                 // 5    0  
        //Console.WriteLine( userInput % 10 );                  // 7    6  
        //Console.WriteLine( userInput % 100 );                 // 67   56 
        Console.WriteLine();

        if (userInput == 0)
        {
            Console.Write("Zero");
        }
        else if (userInput == 1)
        {
            Console.Write("One");
        }
        else if (userInput == 2)
        {
            Console.Write("Two");
        }
        else if (userInput == 3)
        {
            Console.Write("Three");
        }
        else if (userInput == 4)
        {
            Console.Write("Four");
        }
        else if (userInput == 5)
        {
            Console.Write("Five");
        }
        else if (userInput == 6)
        {
            Console.Write("Six");
        }
        else if (userInput == 7)
        {
            Console.Write("Seven");
        }
        else if (userInput == 8)
        {
            Console.Write("Eight");
        }
        else if (userInput == 9)
        {
            Console.Write("Nine");
        }
        else if (userInput == 10)
        {
            Console.Write("Ten");
        }
        else if (userInput == 11)
        {
            Console.Write("Eleven");
        }
        else if (userInput == 12)
        {
            Console.Write("Twelve");
        }
        else if (userInput == 13)
        {
            Console.Write("Thirteen");
        }
        else if (userInput == 14)
        {
            Console.Write("Fourteen");
        }
        else if (userInput == 15)
        {
            Console.Write("Fifteen");
        }
        else if (userInput == 16)
        {
            Console.Write("Sixteen");
        }
        else if (userInput == 17)
        {
            Console.Write("Seventeen");
        }
        else if (userInput == 18)
        {
            Console.Write("Eighteen");
        }
        else if (userInput == 19)
        {
            Console.Write("Nineteen");
        }
        else if (userInput < 0 || userInput > 999)
        {
            Console.Write("Wrong number!");
        }
        else
        {
            switch (userInput / 100)
            {
                case 1: Console.Write("One hundred"); break;
                case 2: Console.Write("Two hundred"); break;
                case 3: Console.Write("Three hundred"); break;
                case 4: Console.Write("Four hundred"); break;
                case 5: Console.Write("Five hundred"); break;
                case 6: Console.Write("Six hundred"); break;
                case 7: Console.Write("Seven hundred"); break;
                case 8: Console.Write("Eight hundred"); break;
                case 9: Console.Write("Nine hundred"); break;
                case 0: switch (userInput / 10)
                    {
                        case 2: Console.Write("Twenty"); break;
                        case 3: Console.Write("Тhirty"); break;
                        case 4: Console.Write("Fourty"); break;
                        case 5: Console.Write("Fifty"); break;
                        case 6: Console.Write("Sixty"); break;
                        case 7: Console.Write("Seventy"); break;
                        case 8: Console.Write("Eighty"); break;
                        case 9: Console.Write("Ninety"); break;
                    } break;
            }

            if (userInput / 100 != 0 && (userInput / 10) % 10 != 1 && userInput % 10 != 0)
            {
                switch ((userInput / 10) % 10)
                {
                    case 2: Console.Write(" twenty"); break;
                    case 3: Console.Write(" thirty"); break;
                    case 4: Console.Write(" fourty"); break;
                    case 5: Console.Write(" fifty"); break;
                    case 6: Console.Write(" sixty"); break;
                    case 7: Console.Write(" seventy"); break;
                    case 8: Console.Write(" eighty"); break;
                    case 9: Console.Write(" ninety"); break;
                }
            }
            else if (userInput / 100 != 0 && (userInput / 10) % 10 != 1 && userInput % 10 == 0)
            {
                switch ((userInput / 10) % 10)
                {
                    case 2: Console.Write(" and twenty"); break;
                    case 3: Console.Write(" and thirty"); break;
                    case 4: Console.Write(" and fourty"); break;
                    case 5: Console.Write(" and fifty"); break;
                    case 6: Console.Write(" and sixty"); break;
                    case 7: Console.Write(" and seventy"); break;
                    case 8: Console.Write(" and eighty"); break;
                    case 9: Console.Write(" and ninety"); break;
                }
            }

            if ((userInput / 10) % 10 == 1)
            {
                switch (userInput % 10)
                {
                    case 1: Console.Write(" and eleven"); break;
                    case 2: Console.Write(" and twelve"); break;
                    case 3: Console.Write(" and thirteen"); break;
                    case 4: Console.Write(" and fourteen"); break;
                    case 5: Console.Write(" and fifteen"); break;
                    case 6: Console.Write(" and sixteen"); break;
                    case 7: Console.Write(" and seventeen"); break;
                    case 8: Console.Write(" and eighteen"); break;
                    case 9: Console.Write(" and nineteen"); break;
                }
            }
            else if (userInput / 100 != 0 && (userInput / 10) % 10 == 0)
            {
                switch (userInput % 10)
                {
                    case 1: Console.Write(" and one"); break;
                    case 2: Console.Write(" and two"); break;
                    case 3: Console.Write(" and three"); break;
                    case 4: Console.Write(" and four"); break;
                    case 5: Console.Write(" and five"); break;
                    case 6: Console.Write(" and six"); break;
                    case 7: Console.Write(" and seven"); break;
                    case 8: Console.Write(" and eight"); break;
                    case 9: Console.Write(" and nine"); break;
                }
            }
            else
            {
                switch (userInput % 10)
                {
                    case 1: Console.Write(" one"); break;
                    case 2: Console.Write(" two"); break;
                    case 3: Console.Write(" three"); break;
                    case 4: Console.Write(" four"); break;
                    case 5: Console.Write(" five"); break;
                    case 6: Console.Write(" six"); break;
                    case 7: Console.Write(" seven"); break;
                    case 8: Console.Write(" eight"); break;
                    case 9: Console.Write(" nine"); break;
                }
            }
        }
        Console.WriteLine();
        Console.WriteLine();
        goto Begin;
    }
}